package m.jclecai.com.adapter.lotteryNumberMenu;

import android.content.Context;
import android.view.ViewGroup;

import m.jclecai.com.R;
import m.jclecai.com.adapter.base.RyAdapter;
import m.jclecai.com.adapter.holder.lotteryNumberMenu.LotteryNumberLineHolder;
import m.jclecai.com.bean.LotteryNumberMenuBean;
import m.jclecai.com.bean.MissDataBean;
import m.jclecai.com.listener.OnBallCheckedListener;

/**
 * Created by zed on 2018/3/19.
 */

public class LotteryNumberLineAdapter extends RyAdapter<LotteryNumberLineHolder> {
    LotteryNumberMenuBean bean;
    Context mContent;
    OnBallCheckedListener mOnBallCheckedListener;
    //是否显示遗漏
    boolean isShowMissData = false;
    //遗漏
    MissDataBean missDataBean;
    //当前第几行的下标
    int lineIndex = 0;
    int defCheckMenu = 0;

    public LotteryNumberLineAdapter(Context mContent) {
        this.mContent = mContent;
    }

    @Override
    public LotteryNumberLineHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new LotteryNumberLineHolder(inflate(mContent, R.layout.layout_item_ball, parent, false));
    }

    @Override
    public void onBindViewHolder(LotteryNumberLineHolder holder, int position) {
        holder.init(defCheckMenu, bean, position, lineIndex);
        holder.setShowMissData(isShowMissData);
        holder.setMissDataBean(missDataBean, lineIndex, position);
        holder.setOnBallCheckedListener(mOnBallCheckedListener);
    }

    @Override
    public int getItemCount() {
        return bean == null ? 0 : bean.getItemLineCount();
    }

    public void setBean(LotteryNumberMenuBean bean) {
        this.bean = bean;
        notifyDataSetChanged();
    }

    public void setOnBallCheckedListener(OnBallCheckedListener onBallCheckedListener) {
        mOnBallCheckedListener = onBallCheckedListener;
    }

    public void setLineIndex(int lineIndex) {
        this.lineIndex = lineIndex;
    }

    public void setDefCheckMenu(int defCheckMenu) {
        this.defCheckMenu = defCheckMenu;
    }

    public void setMissDataBean(MissDataBean missDataBean) {
        this.missDataBean = missDataBean;
    }

    public void setShowMissData(boolean isShowMissData) {
        this.isShowMissData = isShowMissData;
    }
}
